 

/**
 * uploadButtionId : 上传按钮id
 * cancelButtonId  : 取消按钮id  (可空--完全可空)
 * imgTagId : 图片标签id    (可空--当isCallback == true ) 
 * inputImageId : 图片处理   (可空--当isCallback == true )
 * compre: 是否压缩
 * isCallback : 是否调用回调地址
 * callback 回调地址的
 * 
 */
/*  {
	uploadButtionId :"",
	cancelButtonId:"",
	imgTagId : "",
	inputImageId :"",
	isCallback : false,
	compre : false,
	callback : function (data){
		
	}
};
*/

 function MySwfUpLoad(MySettings){
	if(MySettings.cancelButtonId == undefined || null ==MySettings.cancelButtonId ){ 
		MySettings.cancelButtonId ="cancelButtonId";
	}
	if(MySettings.cancelButtonId == undefined || null ==MySettings.cancelButtonId ){
		MySettings.cancelButtonId =false;
	}
	
	var isCompre =1;
	var isCutImage =1;
	if(MySettings.compre!= undefined && true==MySettings.compre){
		isCompre=2;
		isCutImage=2;
	}
	
	
	var swfu;  
	var settings = {
		flash_url : "js/swfupload/swfupload.swf",
		upload_url: "http://img.vestar.cn/YmUpload_image",
		post_params: {
			isCompre:isCompre,
			isCutImage: isCutImage
		},
		file_size_limit : "3 MB",
		file_types : "*.jpg;*.gif;*.png",
		file_types_description : "Web Image Files",
		file_upload_limit : 100,
		file_queue_limit : 0,
		custom_settings : { 
			cancelButtonId : MySettings.cancelButtonId
		},
		debug: false,
		
		// Button settings
		button_image_url: "../images/manager/myUpLoad.png",
		button_width: "26",
		button_height: "26",
		button_placeholder_id: MySettings.uploadButtionId,
		button_text: '',
		button_text_style: ".theFont { font-size: 16; }",
		button_text_left_padding: 12,
		button_text_top_padding: 3,
		button_action : SWFUpload.BUTTON_ACTION.SELECT_FILE,
		
		// The event handler functions are defined in handlers.js
		file_queued_handler : fileQueued,
		file_queue_error_handler : fileQueueError,
		file_dialog_complete_handler : fileDialogComplete,
		upload_start_handler : uploadStart,
		upload_progress_handler : uploadProgress,
		upload_error_handler : uploadError,
		upload_success_handler : function(fileObj,server_data){
			if(MySettings.isCallback){
				callback(server_data);
			}else{
				defaultMethod(server_data,MySettings.imgTagId,MySettings.inputImageId);
			}
		},
		upload_complete_handler : uploadComplete,
		queue_complete_handler : queueComplete	// Queue plugin event
	}; 

	swfu = new SWFUpload(settings);  
} 
			
 function defaultMethod(server_data,imgTagId,inputImageId){
		var server_data_json = eval('(' + server_data + ')'); 
		var imageObj= document.getElementById(imgTagId);
		imageObj.setAttribute("src",server_data_json.data.url); 
		var inputImageIdObj = document.getElementById(inputImageId);
		inputImageIdObj.setAttribute("value",server_data_json.data.url); 
}